# -*- coding:utf-8 -*-
class Solution:
    def LeftRotateString(self, s, n):
        # write code here
        s = list(s)
        l = len(s)
        if l < n or l == 0:
            return ''
        self.help(s, 0, n - 1)
        self.help(s, n, l - 1)
        self.help(s, 0, l - 1)
        return ''.join(s)
    def help(self, s, start, end):
        while start < end:
            s[start], s[end] = s[end], s[start]
            start += 1
            end -= 1

a = 'XYZdefabc'
s=Solution()
print(s.LeftRotateString(a,3))